package com.chixing.controller;

import com.chixing.pojo.Member;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("jsonDemo")
public class JsonDemoController {
    @RequestMapping("fun1")
    @ResponseBody //将响应数据 转换成 json格式
    public String fun1(Integer id,String memberName){
        System.out.println("json demo id:" + id + ", name :" + memberName);
        return "20";
    }

    @RequestMapping("fun2")
    @ResponseBody //将响应数据 转换成 json格式
    public Member fun2(Integer id,String memberName){
        System.out.println("json demo id:" + id + ", name :" + memberName);
        Member member = new Member();
        member.setMemberId(id);
        member.setMemberName(memberName);
        member.setMemberTelno(18799485748L);
        return member;
    }


}
